package com.white.commonlib.utils;

/**
 * Created by yutf on 2017/6/9 0009.
 */

public class StringUtils
{
    private static char[] charc = {
            'A','B','C','D','E',
            'F','G','H','I','J',
            'K','L','M','N','O',
            'P','Q','R','S','T',
            'U','V','W','X','Y','Z'
    };

    public static String getCharactorIndex(int position)
    {
        if(position  >= 0 && position <= 25)
        {
            return String.valueOf(charc[position]);
        }
        return "NULL";
    }

    public static int getNumIndex(char c)
    {
        for(int i = 0;i<charc.length;i++)
        {
            char uper = charc[i];
            char lower = (char) (uper + 32);
            if(c == uper || c == lower)
            {
                return i;
            }
        }
        return -1;
    }
}
